package ui.activity.mine.biz;

import base.BaseBiz;
import base.BaseResp;
import coom.BaseSubscribe;
import coom.RetrofitHelp;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import ui.model.AccountMoneyInfo;
import ui.model.ItemsInfo;
import ui.model.WithDrawInfo;

/**
 * Created by chenjian on 19/2/26.
 * 1
 */

public class MyWalletBiz extends BaseBiz {

    /**
     * 获取钱包信息
     */
    public void getUserIncome(final Callback<ItemsInfo<AccountMoneyInfo>> callback) {
        com.add(RetrofitHelp.getSecretApi().accountInfo()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ItemsInfo<AccountMoneyInfo>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ItemsInfo<AccountMoneyInfo>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ItemsInfo<AccountMoneyInfo>) obj);
                    }
                })
        );
    }

    /**
     * 获取提现信息
     */
    public void getWithDrawInfo(final Callback<WithDrawInfo> callback) {
        com.add(RetrofitHelp.getSecretApi().withDrawInfo()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<WithDrawInfo>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((WithDrawInfo) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((WithDrawInfo) obj);
                    }
                })
        );
    }
}
